package com.own.component.common.base.entity;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.own.component.common.base.entity.po.BaseBean;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.FieldNameConstants;

import java.io.Serializable;

/**
 * BaseMap
 *
 * @author chenxueli
 * @date 2020/12/24 17:28
 */
@Schema(title = "后端返回给前端的视图对象map")
@Getter
@Setter
@ToString
@NoArgsConstructor
@FieldNameConstants
public abstract class BaseMap<BEAN extends BaseBean> implements Serializable {

    @Schema(title = "主键id")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Long id;

    /**
     * 构造方法
     *
     * @param entity 原对象
     */
    public BaseMap(@NonNull BEAN entity) {
        this.id = entity.getId();
    }

}
